/**
 * Copyright (c) 2020 kedacom
 * OpenATC is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 * http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 **/
package com.openatc.agent.model;

import lombok.Data;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;

@Data
@Entity
@Table(name = "sys_role_permission",schema = "auth2")
public class RolePermission {
//    @Id
//    @GeneratedValue
    @Id
    @GeneratedValue(generator = "sequence-generator_rp")
    @GenericGenerator(
        name = "sequence-generator_rp",
        strategy = "org.hibernate.id.enhanced.SequenceStyleGenerator",
        parameters = {
                @org.hibernate.annotations.Parameter(name = "sequence_name", value = "auth2.sys_role_permission_id_seq"),
                @org.hibernate.annotations.Parameter(name = "initial_value", value = "1500"),
                @org.hibernate.annotations.Parameter(name = "increment_size", value = "1")
        }
    )
    private int id;

    @ManyToOne
    @JoinColumn(name = "role_id")
    private Role role; // 角色

    @ManyToOne
    @JoinColumn(name = "permission_id")
    private Permission permission; //权限
}
